import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.tree.*;
import java.rmi.*;
//import org.omg.CosNaming.*;
import javax.swing.border.*;


public class LabExam extends JInternalFrame implements ClientInterface
{
	String ra[] = null;
	//static int t = 1;
	public LabExam()
	{
		super("Lab Examination",false,true,false,false);
		this.setBounds(20,0,740,500);
		setVisible(true);
		
		
		
		Container c = getContentPane();
		c.setLayout(null);
		
		
		jsp3.setBounds(40,50,640,300);
		c.add(jsp3);
		jsp3.setBorder(new LineBorder(Color.black,1));
		
		lab1.setBounds(40,15,150,20);
		lab1.setFont(new Font("Verdana",Font.PLAIN,12));
		c.add(lab1);
		//lab1.setBorder(new LineBorder(Color.gray,1));
		
		lab2.setBounds(195,15,30,20);
		c.add(lab2);
		lab2ex.setBounds(240,15,40,20);
		c.add(lab2ex);
		lab2ex.setFont(new Font("Verdana",Font.PLAIN,12));
		
		lab9.setBounds(385,15,140,20);
		lab9.setFont(new Font("Verdana",Font.BOLD,16));
		c.add(lab9);
		//lab3.setBorder(new LineBorder(Color.gray,1));
		
		lab10.setBounds(480,15,150,20);
		lab10.setFont(new Font("Verdana",Font.BOLD,16));
		c.add(lab10);
		//lab4ex.setBounds(595,15,40,20);
		//c.add(lab4ex);
		//lab4ex.setFont(new Font("Verdana",Font.PLAIN,12));
		
		lab5.setBounds(40,360,120,20);
		lab5.setFont(new Font("Verdana",Font.PLAIN,12));
		//lab5.setBorder(new LineBorder(Color.gray,1));
		c.add(lab5);
		
		lab6.setBounds(160,360,20,20);
		lab6.setFont(new Font("Verdana",Font.PLAIN,12));
		//lab6.setBorder(new LineBorder(Color.gray,1));
		c.add(lab6);
		
		lab7.setBounds(190,360,170,20);
		lab7.setFont(new Font("Verdana",Font.PLAIN,12));
		//lab7.setBorder(new LineBorder(Color.gray,1));
		c.add(lab7);
		
		lab8.setBounds(40,390,30,20);
		lab8.setFont(new Font("Verdana",Font.PLAIN,12));
		//lab8.setBorder(new LineBorder(Color.pink,1));
		c.add(lab8);
		
		taf1.setBounds(72,390,280,20);
		//taf1.setFont(new Font("Verdana",Font.PLAIN,12));
		taf1.setBorder(new LineBorder(Color.red,1));
		c.add(taf1);
		//taf1.setVisible(false);
		
		bt2.setBounds(175,410,90,30);
		bt2.setFont(new Font("Verdana",Font.PLAIN,12));
		//lab7.setBorder(new LineBorder(Color.gray,1));
		c.add(bt2);
		//bt2.setEnabled(false);
		
		bt1.setBounds(267,410,92,30);
		bt1.setFont(new Font("Verdana",Font.PLAIN,12));
		//lab7.setBorder(new LineBorder(Color.gray,1));
		c.add(bt1);
		//bt1.setEnabled(false);
		
		
		
		browseBut hand1 = new browseBut();
		bt1.addActionListener(hand1);
		
		sendBut hand2 = new sendBut();
		bt2.addActionListener(hand2);
		
		bt1.setEnabled(true);
		bt2.setEnabled(true);
		
		
		
		try
		{
			UIManager.setLookAndFeel(looks[1].getClassName());
			SwingUtilities.updateComponentTreeUI(this);
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
		
		try
		{
			String addServerUrl = "rmi://"+clientconf.getText()+"/MainServer" ;
			MainServerInterface se = (MainServerInterface)Naming.lookup(addServerUrl);
		
		String ra1 = se.QuesSend("Rabbi1");
		String ra2 = se.TimeSend("Rabbi2");
		String ra3 = se.NumQues("Rabbi3");
		//String ra4 = se.answSubm("Rabbi4");
		
		tar1.setText(ra1);
		lab2.setText(ra2);
		lab6.setText(ra3);
		//lab4.setText(ra4);
		
		Thr thr1 = new Thr("Thread1");
		thr1.start();
		}
		catch(Exception e)
		{
			System.out.println("Error..");
			//e.printStackTrace();
			JOptionPane.showMessageDialog(null,"No LabExam Present for you..\n Contact to the Administrator.","Error",JOptionPane.ERROR_MESSAGE);
		}
		
	}
	
}
